/* 
 * File:   dropboxestest.cpp
 * Author: dolphinigle
 *
 * Created on March 12, 2011, 8:48 PM
 */

#include <stdlib.h>
#include "gtest/gtest.h"
#include "dropbox.hpp"
#include "game.hpp"
#include "plantablecell.hpp"
#include "dropboxes.hpp"
#include "fieldconstants.hpp"

TEST(DropBoxesTest, All) {

  Game* game = new Game("Irvan", "test.gag");
  DropBoxes* dropboxes = new DropBoxes(game);

  int maxx = game->getMaps()->getField()->getGrid()->getColumn();
  int maxy = game->getMaps()->getField()->getGrid()->getRow();
  for (int i = 0; i < maxx; ++i) {
    for (int j = 0; j < maxy; ++j) {
      bool contain = false;
      for (int k = 0; k < FieldConstants::getDropBoxesCount(); ++k) {
        if (FieldConstants::getDropBoxXCoordinate(k) == i &&
                FieldConstants::getDropBoxYCoordinate(k) == j) {
          EXPECT_FALSE(dropboxes->getDropBoxAt(
                  game->getMaps()->getField()->getCellAt(i,j))->isSteppable());
          contain = true;
        }
      }
      EXPECT_EQ(contain, dropboxes->containsDropBoxAt(
              game->getMaps()->getField()->getCellAt(i,j)));
    }
  }

  delete dropboxes;
  delete game;

}

